package com.kujie.access.domain.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.kujie.access.domain.po.AccessEnterpriseRentalInformation;
import com.kujie.access.domain.po.AccessTenantManagement;
import com.kujie.common.excel.annotation.ExcelDictFormat;
import com.kujie.common.excel.convert.ExcelDictConvert;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;

/**
 * 企业租赁信息 VO
 *
 * @author check
 * @date 2025-07-03
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EnterpriseRentalInformationVO implements Serializable {
    @Serial
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    /**
     * 企业租赁信息表主键id
     */
    @ExcelIgnore
    private Long id;

    /**
     * 企业uuid
     */
    @ExcelIgnore
    private String companyUuid;

    /**
     * 企业名称
     */
    @ExcelProperty("企业名称")
    private String companyName;

    /**
     * 栋号
     */
    @ExcelProperty("栋号")
    private String buildingNo;

    /**
     * 房号
     */
    @ExcelProperty("房号")
    private String roomNumber;

    /**
     * 联系人
     */
    @ExcelProperty("联系人")
    private String contact;

    /**
     * 联系电话
     */
    @ExcelProperty("联系方式")
    private String contactPhone;

    /**
     * 法人
     */
    @ExcelProperty("法人")
    private String companyLegelPerson;

    /**
     * 法人身份证
     */
    @ExcelProperty("法人身份证")
    private String companyLegelIdCard;

    /**
     * 面积
     */
    @ExcelProperty("面积")
    private String area;

    /**
     * 签合同日期
     */
    @ExcelProperty("签合同日期")
    @DateTimeFormat("yyyy/M/d")
    private LocalDate signDate;

    /**
     * 租赁期限
     */
    @ExcelProperty("租赁期限")
    private String termOfLease;

    /**
     * 租赁时间
     */
    @ExcelProperty("租赁时间")
    @DateTimeFormat("yyyy/M/d")
    private LocalDate leaseDate;

    /**
     * 到期时间
     */
    @ExcelProperty("到期时间")
    @DateTimeFormat("yyyy/M/d")
    private LocalDate expireDate;

    /**
     * 免租时间
     */
    @ExcelProperty("免租时间")
    private String rentFreePeriod;

    /**
     * 免租期
     */
    @ExcelProperty("免租期")
    private String rentFreePeriodDate;

    /**
     * 宇总批示
     */
    @ExcelProperty("宇总批示")
    private String generalOrder;

    /**
     * 租金单价
     */
    @ExcelProperty("租金单价")
    private String rentPerUnit;

    /**
     * 月房租
     */
    @ExcelProperty("月房租")
    private String monthlyRent;

    /**
     * 季度房租
     */
    @ExcelProperty("季度房租")
    private String quarterlyRent;

    /**
     * 保证金
     */
    @ExcelProperty("保证金")
    private String earnestMoney;

    /**
     * 租金到期时间
     */
    @ExcelProperty("租金到期时间")
    @DateTimeFormat("yyyy/M/d")
    private LocalDate rentExpirationDate;

    /**
     * 交房时间
     */
    @ExcelProperty("交房时间")
    @DateTimeFormat("yyyy/M/d")
    private LocalDate completionDate;

    /**
     * 退租日期
     */
    @ExcelProperty("退租日期")
    @DateTimeFormat("yyyy/M/d")
    private LocalDate leaseTerminationDate;

    /**
     * 是否精装
     */
    @ExcelProperty(value = "是否精装", converter = ExcelDictConvert.class)
    @ExcelDictFormat(dictType = "sys_status_is")
    private String isHardcover;

    /**
     * 转介情况
     */
    @ExcelProperty("转介情况")
    private String referralSituation;

    /**
     * 特殊审批事项
     */
    @ExcelProperty("特殊审批事项")
    private String specialApprovalMatters;

    /**
     * 置业顾问
     */
    @ExcelProperty("置业顾问")
    private String propertyConsultant;

    /**
     * 备注
     */
    @ExcelProperty("备注")
    private String remark;

    public EnterpriseRentalInformationVO(AccessEnterpriseRentalInformation accessEnterpriseRentalInformation, AccessTenantManagement accessTenantManagement) {
        if (accessTenantManagement != null) {
            this.companyUuid = accessTenantManagement.getCompanyUuid();
            this.companyName = accessTenantManagement.getCompanyName();
            this.contact = accessTenantManagement.getAdministrativeContactPerson();
            this.contactPhone = accessTenantManagement.getAdministrativeContactPersonPhone();
            this.companyLegelPerson = accessTenantManagement.getCompanyLegelPerson();
            this.companyLegelIdCard = accessTenantManagement.getLegelIdCard();
        }

        if (accessEnterpriseRentalInformation != null) {
            this.id = accessEnterpriseRentalInformation.getId();
            this.buildingNo = accessEnterpriseRentalInformation.getBuildingNo();
            this.roomNumber = accessEnterpriseRentalInformation.getRoomNumber();
            this.area = accessEnterpriseRentalInformation.getArea();
            this.signDate = accessEnterpriseRentalInformation.getSignDate();
            this.termOfLease = accessEnterpriseRentalInformation.getTermOfLease();
            this.leaseDate = accessEnterpriseRentalInformation.getLeaseDate();
            this.expireDate = accessEnterpriseRentalInformation.getExpireDate();
            this.rentFreePeriod = accessEnterpriseRentalInformation.getRentFreePeriod();
            this.rentFreePeriodDate = accessEnterpriseRentalInformation.getRentFreePeriodDate();
            this.generalOrder = accessEnterpriseRentalInformation.getGeneralOrder();
            this.rentPerUnit = accessEnterpriseRentalInformation.getRentPerUnit();
            this.monthlyRent = accessEnterpriseRentalInformation.getMonthlyRent();
            this.earnestMoney = accessEnterpriseRentalInformation.getEarnestMoney();
            this.quarterlyRent = accessEnterpriseRentalInformation.getQuarterlyRent();
            this.rentExpirationDate = accessEnterpriseRentalInformation.getRentExpirationDate();
            this.completionDate = accessEnterpriseRentalInformation.getCompletionDate();
            this.leaseTerminationDate = accessEnterpriseRentalInformation.getLeaseTerminationDate();
            this.isHardcover = accessEnterpriseRentalInformation.getIsHardcover();
            this.referralSituation = accessEnterpriseRentalInformation.getReferralSituation();
            this.specialApprovalMatters = accessEnterpriseRentalInformation.getSpecialApprovalMatters();
            this.propertyConsultant = accessEnterpriseRentalInformation.getPropertyConsultant();
            this.remark = accessEnterpriseRentalInformation.getRemark();
        }
    }
}
